<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/11/23 0023
  Time: 上午 11:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改界面</title>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/common.css">
    <link rel="stylesheet" href="/static/plugins/css/zTreeStyle/zTreeStyle.css" type="text/css">
</head>
<body>

<div class="box-padding-15">
         <span class="layui-breadcrumb">
          <a href="#">首页>></a>
          <a href="javascript:;">门店管理>></a>
          <a><cite>修改页面</cite></a>
        </span>
    <hr>
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">门店管理</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="box-form">
                    <form class="layui-form "  method="post">
                        <div class="layui-form-item">
                            <label class="layui-form-label">门店名：</label>
                            <div class="layui-input-block">
                                <input type="hidden" value="${dept.deptId}" name="deptId" id="deptId">
                                <input type="text" value="${dept.deptName}" name="deptName" id="deptName" required  lay-verify="required"  autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">电话：</label>
                            <div class="layui-input-block">
                                <input type="text" value="${dept.deptPhone}" name="deptPhone" id="deptPhone" required  lay-verify="required"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">店长：</label>
                            <div class="layui-input-block">
                                <input type="text" value="${dept.ownerName}" name="ownerName" id="ownerName" required  lay-verify="required"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机：</label>
                            <div class="layui-input-block">
                                <input type="text" value="${dept.ownerMobile}" name="ownerMobile" id="ownerMobile" required  lay-verify="required"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">城市：</label>
                            <div class="layui-input-block">
                                <input type="text" value="${dept.inCity}" name="inCity" id="inCity" required  lay-verify="required"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">地址：</label>
                            <div class="layui-input-block">
                                <input type="text" value="${dept.address}" name="address" id="address" required  lay-verify="required"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">经度：</label>
                            <div class="layui-input-block">
                                <input type="text" value="${dept.gpsLon}" name="gpsLon" id="gpsLon" required  lay-verify="required"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">纬度：</label>
                            <div class="layui-input-block">
                                <input type="text" value="${dept.gpsLat}" name="gpsLat" id="gpsLat" required  lay-verify="required"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">备注：</label>
                            <div class="layui-input-block">
                                <input type="text" value="${dept.remark}" name="remark" id="remark" required  lay-verify="required"  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="formSubmit" id="submit">保存</button>
                                <a href="/dept"><button type="button" class="layui-btn layui-btn-primary">取消</button></a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>


<script src="/static/plugins/jquery-3.2.1.min.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<script src="/static/js/common.js"></script>
<script>
    //加载模块
    layui.use(["form","element","layer",'laydate','upload'],function () {
        var form = layui.form;
        var laydate=layui.laydate;
        var upload=layui.upload;
        var layer=layui.layer;
        /*//加载时间
        var ins22 = laydate.render({
            elem: '#addTime'
            ,min: '2000-1-1'
            ,max: '2100-1-1'
            ,ready: function(){
                ins22.hint('日期');
            }
        });*/
        form.on('submit(formSubmit)', function(data){
            //进行异步保存
            debugger
            $.ajax({
                url: "/dept/update",
                type:"post",
                data:data.field,
                dataType: 'json',
                success:function(rs){
                    debugger
                    layer.msg(rs.message);
                    if(rs.code==1){
                        layer.msg("修改成功",{time:2000},function(){
                            location.href="/dept";
                        })
                    }else{
                        debugger
                        layer.msg("修改失败");
                    }

                },
                error:function(){
                    layer.msg("服务器忙，请稍后再试！");
                }
            });
            return false;
        });
    })
</script>
</body>
</html>

